<template>
  <div class="dashboard-editor-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData"/>

    <!--    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">-->
    <!--      <line-chart :chart-data=[5,4,6,7] />-->
    <!--    </el-row>-->
    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <ve-line :data="chartData" :settings="chartSettings"></ve-line>
    </el-row>


  </div>
</template>

<script>
import { getWeekData } from '@/api/index'
import PanelGroup from './dashboard/PanelGroup'
import LineChart from './dashboard/LineChart'

const lineChartData = {
  newVisitis: {
    expectedData: []
  }
}

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart
  },
  data() {
    return {
      chartData: {
        columns: ['days', 'count'],
        rows: [
          {
            'days': '',
            'count': 0,
          },
        ]
      },
      chartSettings:{
        labelMap:{
          count :"提交材料个数"
        }
      },
      lineChartData: lineChartData.newVisitis
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      getWeekData().then(res => {
        console.log(res)
        this.chartData.rows = res.weekData
      })
    },
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    }
  }
}

</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
